package com.onstar.cn.framework.utils;

import com.onstar.cn.common.exception.HttpException;
import com.onstar.cn.common.exception.OnStarException;

/**
 * Created by 6335yz on 2016/6/28.
 */
public class ExceptionUtil {

    public static HttpException toHttpException(Exception e) {
        return new HttpException(e);
    }

    public static OnStarException toOnStarException(Exception e) {
        return new OnStarException(e);
    }

    public static HttpException toOnStarException(String errorCode, String errorMsg) {
        return new HttpException(errorCode, errorMsg);
    }

    public static OnStarException defaultException(Exception e) {
        return codeException(e, "SOMP-904");
    }

    public static OnStarException codeException(Exception e, String code) {
        return new OnStarException(code, e.getMessage());
    }
//    public static HttpException defaultException(Exception e,String code) {
//        return new HttpException(ErrorEnum.SOMP_904.getStringValue(), e.getMessage());
//    }
}
